import express from 'express';
import cors from 'cors';
import multer from 'multer';
import travelRoutes from './routes/travel';

const app = express();
const port = process.env.PORT || 8085;

// 配置multer用于处理文件上传
const storage = multer.memoryStorage();
const upload = multer({ storage });

// 中间件
app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

// 路由
app.use('/api/travels', upload.array('files'), travelRoutes);

// 启动服务器
app.listen(port, () => {
    console.log(`服务器运行在 http://localhost:${port}`);
}); 